import { useParams, withRouter } from 'umi';

function CounterPage(props) {
  // 获取路径参数
  // const params = useParams();
  // console.log(params);
  // const { name, age } = params;

  console.log(props);
  const {name, age} = props.params
  
  
  return (
    <div>
      <p>This is umi CounterPage.</p>
      <p>name: {name}</p>
      <p>age: {age}</p>
    </div>
  );
}

// export default CounterPage;
// 使用withRouter将组件包起来，就可以将路由动态参数作为组件的props传入了
export default withRouter(CounterPage);
